/**
 * Title : jFamilyTree
 * Description: jFamilyTree
 * About: Designed and rewritten by Andreas Lundgren, based on the Treebolic application suite
 * Copyright:	(c) 2001-2008
 * Terms of use:see license agreement at http://treebolic.sourceforge.net/en/license.htm
 * Author: Bernard Bou
 * Company: bsys
 */
package jFamilyTree.commons;

import java.awt.Component;
import java.awt.Dimension;
import java.awt.Toolkit;

/**
 * Utilities
 * 
 * @author Bernard Bou
 */
public class Utils
{
	// C E N T E R

	/**
	 * Center on screen
	 * 
	 * @param thisComponent
	 *        component to center
	 */
	static public void center(Component thisComponent)
	{
		Dimension thisScreenSize = Toolkit.getDefaultToolkit().getScreenSize();
		Dimension thisComponentSize = thisComponent.getSize();
		if (thisComponentSize.height > thisScreenSize.height)
			thisComponentSize.height = thisScreenSize.height;
		if (thisComponentSize.width > thisScreenSize.width)
			thisComponentSize.width = thisScreenSize.width;
		thisComponent.setLocation((thisScreenSize.width - thisComponentSize.width) / 2, (thisScreenSize.height - thisComponentSize.height) / 2);
	}
}
